package demo2;

import demo2.SingletonHungry;

/**
 * 测试饿汉模式在单线程的环境下
 */
public class TestHungry {
    public static void main(String[] args) {
        SingletonHungry instance1=SingletonHungry.getInstance();
        System.out.println(instance1);
        SingletonHungry instance2=SingletonHungry.getInstance();
        System.out.println(instance1);
        SingletonHungry instance3=SingletonHungry.getInstance();
        System.out.println(instance1);
        //单线程环境下没有问题
    }
}
